﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simple.Repository.Models.Attendance
{
    public class StaffAttendanceUser : BusinessFullEntityBase<Guid>
    {

        /// <summary>
        /// 人员Id
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 人员姓名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 员工规则Id
        /// </summary>
        public Guid? StaffAttendanceRuleId { get; set; } = null;

        /// <summary>
        /// 班级动态信息
        /// </summary>
        public StaffAttendanceRule StaffAttendanceRule = new StaffAttendanceRule();

        public override void ConfigureEntity(ModelBuilder builder)
        {
            builder.Entity<StaffAttendanceUser>(entity =>
            {
                entity.ToTable("Staff_Attendance_User");
                entity.HasOne(c => c.StaffAttendanceRule).WithMany(c => c.Users).HasForeignKey(c => c.StaffAttendanceRuleId);
            });
        }
    }
}
